package ReviewTest;

import java.util.ArrayList;

public class demo06 {
    public static void main(String[] args) {
        String arr[] = {"aafasasf", "sads1", "jjww", "lili" };
        change(arr);
    }


    public static void change(String[] arr) {
        ArrayList<String> list = new ArrayList<>();
        //遍历集合存入String[] arr
        for (int i = 0; i < arr.length; i++) {
            list.add(arr[i]);
        }
        //查看存入后的集合元素
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        //外循环遍历集合，得到每一组字符串
        for (int i = 0; i < list.size(); i++) {
            //将每一组字符串转为对应的字符数组
            char[] crr = list.get(i).toCharArray();
            //每一组字符串的字符数组再遍历，查看是否含有字符a
            for (int i1 = 0; i1 < crr.length; i1++) {
                if (crr[i1] == 'a') {
                    list.remove(i);
                    i--;
                    break;
                }
            }
        }
        System.out.println("删除字符串之后的集合元素有：");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}
